package org.pine.common.exception;

import lombok.Getter;
import org.pine.api.enums.ResultCodeEnum;

import java.io.Serial;

/**
 * 自定义系统异常
 *
 * @author pine
 * @version v1.0
 * @since 2025-04-12 15:07
 */
@Getter
public class PineException extends RuntimeException {
    @Serial
    private static final long serialVersionUID = 2857513611081764711L;

    /**
     * 异常信息
     */
    private final String message;

    /**
     * 具体异常码
     */
    private final Integer code;


    public PineException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public PineException(ResultCodeEnum exceptionCode) {
        this(exceptionCode.getCode(), exceptionCode.getDesc());
    }
}
